<template>
  <div>
    <!-- tab -->
    
    <div class="nav">
      <router-link to="/home/index">
      <div>
          <van-icon   name="arrow-left" color="white" size="25" />
      </div>
      </router-link>
      <div class="title">我的订单</div>
    </div>
    
    <!-- 下半部分 -->
    <div class="content">
      <!-- 小海豚图片 -->
      <div>
        <img src="../assets/images/seal.png" alt="">
      </div>
      <!-- 购票框 -->
      <div>
        <div class="Eticket">
          <div class="normal" v-for="(item, i) in ticketlist" :key="i">
            <div>{{ item.name }}</div>
            <div>{{ item.kind }}</div>
            <div class="price">
              <div>￥{{ item.price }}</div>
              <!-- +-按钮 -->
              <div class="count">×{{ item.count }}</div>
              <div>总计:{{ total }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
    return {
      ticketlist: [
        { name: "标准票", kind: "电子票", price: 300, count: 0 },
        { name: "儿童票", kind: "电子票", price: 260, count: 0 },
        { name: "老年人票", kind: "电子票", price: 260, count: 0 },
      ],
      imgSrc: require("../assets/images/seal.png"),
    };
  },
  computed: {
    total() {
      let sum = 0;
      this.ticketlist.forEach((value) => {
        sum += value.price * value.count;
      });
      return sum;
    },
  },
  methods: {
    
  },
  }
</script>

<style scoped>
.nav{
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #0367d7;
  height: 17vw;
  width: 100%;
 
}

.title{
  margin: 0 auto;
  text-align: center;
  color: white;
  font-size: 1.2em;
  font-weight: bold;
  
  
}
.content{
  position: absolute;
  top: 17vw;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #f2f2f2;
}
.Eticket {
  position: relative;
  margin-top: 25px;
  padding-left: 25px;
  padding-right: 25px;
  margin-right: 30px;
  margin-bottom: 120px;
}
.Eticket > div {
  width: 100%;
  height: 100px;
  border: 1px solid gray;
  border-radius: 15px;
  padding: 15px 15px;
  margin-bottom: 20px;
}
.normal > div:first-child {
  font-size: 1.2em;
  font-weight: bold;
  padding-bottom: 8px;
}
.normal > div:nth-child(2) {
  font-size: 0.8em;
  padding-bottom: 12px;
}
.price {
  display: flex;
  justify-content: space-between;
}
.price > div:first-child {
  font-weight: bold;
  font-size: 1.2em;
}
.count {
  display: flex;
  flex-direction: row-reverse;
  margin-right: 15px;
  font-weight: bold;
  position: relative;
  top: 5px;
}
.price > div:last-child {
  font-weight: bold;
}
img{
  width: 45vw;
  height: 50vw;
  position: absolute;
  bottom: 3vw;
  left: 2vw;
}
</style>